<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/estilo.css" rel="stylesheet" type="text/css"/>
<% HttpSession sessao = request.getSession();
	String usuario = (String)sessao.getAttribute("usuario");
	String senha = (String)sessao.getAttribute("senha");
	if(usuario==null)
		response.sendRedirect("telalogin.jsp");
	
%>
<title>Discon</title>
<style type="text/css">
<!--
.style1 {font-family: AddCityboy;
		}
.style2 {
	font-size: 40px;
	color: #0066FF;
}
.style3 {color: #FFFFFF}
-->
</style>
</head>

<body>
	<script type="text/javascript" src="javascript/validandoDados.js"></script>
	<script type="text/javascript">
		function validarDados(){
			if(!verificarNome(document.getElementById("nome")))
			{
				alert("Digite NOME e SOBRENOME");
				document.getElementById("nome").focus();
				document.getElementById("nome").style.backgroundColor="#FFFFAA";
				return false;
			}else if(!verificarTexto(document.getElementById("endereco").value))
			{
				alert("Digite um Endereço Valido");
				document.getElementById("endereco").focus();
				document.getElementById("endereco").style.backgroundColor="#FFFFAA";
				return false;
			}else if (document.getElementById("telefone").value.length!=10){
				alert("Digite um Telefone Valido. /n DDD + TELEFONE = 10 digitos");
				document.getElementById("telefone").focus();
				document.getElementById("telefone").style.backgroundColor="#FFFFAA";
				return false;
			}else if (!verificarEmail(document.getElementById("email"))){
				alert("Digite um E-mail Valido");
				document.getElementById("email").focus();
				document.getElementById("email").style.backgroundColor="#FFFFAA";
				return false;
			}
				
			alert("Campos Validados com sucesso! /n Seu dados foram cadastrados!");
			
			return true;
		}
	</script>
	<div id="geral">
	<jsp:include page="menu.jsp" />
	<div id="corpo">
		<fieldset>
        	<legend class="style1" align="center" >
            	<span class="style2">Cadastro de Pacientes</span>
            </legend>
            <form action="Cadastrando" method="get" >
            <table id="tabela_cadastro" width="946" >
                  <tr>
                    
                    <th width="134" scope="row"><strong>*Nome:</strong></th>
                    <td width="326"><input id="nome" name="nome" type="text" size="50" onkeydown="this.style.backgroundColor='white';"/> </td>
                    
                    <td width="147"><div align="center"><strong>*Endereço</strong>:</div></td>
                    <td width="319"><input id="endereco" name="endereco" type="text" size="50" maxlength="50" onkeydown=				"this.style.backgroundColor='white';" /></td>
                  </tr>
                  <tr>
                      <th scope="row"><strong>*Telefone:</strong></th>
                      <td><input id="telefone" name="telefone" type="text" size="50" maxlength="50" onkeypress="return verificarTel(event);" onkeydown="this.style.backgroundColor='white';" /></td>
                      
                      <td><div align="center"><strong>*E-mail</strong>:</div></td>
                      <td><input id="email" name="email" type="text" size="50" maxlength="50" onkeydown="this.style.backgroundColor='white';"/></td>
                  </tr>
                  <tr>
                    <th colspan="2" scope="row"><div align="left"> Campos com * são obrigatórios</div></th>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                  </tr>
                  <tr>
                          <th colspan="4" scope="row">
                            <input type="submit" onclick="return validarDados();" value="Enviar" />
                            <input type="reset" value="Apagar" />                          </th>
                  </tr>
             </table>    
        </form>
       </fieldset>
       <img src="imagens/rodape.jpg"/>
   </div>
   </div>
</body>
</html>
